﻿var $$ = Dom7;
// Demo
//if (document.location.href.includes('safe-areas')) {
//    const html = document.documentElement;
//    if (html) {
//        html.style.setProperty('--f7-safe-area-top', '44px');
//        html.style.setProperty('--f7-safe-area-bottom', '34px');
//    }
//}
//if (document.location.href.includes('example-preview')) {
//    $$('.view-main').attr('data-browser-history', 'true');
//    $$('.view-main').attr('data-browser-history-root', '/kitchen-sink/core/');
//    $$('.view-main').attr('data-preload-previous-page', 'false');
//    $$('.view-main').attr('data-ios-swipe-back', 'false');
//    document.documentElement.classList.add('example-preview');
//}

// Theme
//var theme = 'auto';
//if (document.location.search.indexOf('theme=') >= 0) {
//    theme = document.location.search.split('theme=')[1].split('&')[0];
//}
//if (document.location.search.indexOf('mode=') >= 0) {
//    const mode = document.location.search.split('mode=')[1].split('&')[0];
//    if (mode === 'dark') document.documentElement.classList.add('dark');
//}


var app = new Framework7({
    el: '#app',
    theme: 'ios',
    // store.js,
    store: window.store,
    // routes.js,
    routes: routes,
    popup: {
        closeOnEscape: true,
    },
    sheet: {
        closeOnEscape: true,
    },
    popover: {
        closeOnEscape: true,
    },
    actions: {
        closeOnEscape: true,
    },
    vi: {
        placementId: 'pltd4o7ibb9rc653x14',
    },
    colors: {
        primary: '#005bc1'
    },
    touch: {
        tapHold: true // 开启长按事件
    }
});

// 修改confirm对话框按钮内置文本
app.params.dialog.buttonCancel = "取消";
app.params.dialog.buttonOk = "确定";

app.on('panelOpen', () => {
    $$("#left-panel a").addClass("left-panel-a");
})

$$("#tabbar-to-home").on("click", () => {
    location.href = "/mobile/index";
})

app.preloadPage


